﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 学生成绩管理系统.Scoreinfo
{
    public partial class mScore : Form
    {
        public mScore()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string strsql;
            string conn = "";
            DataAccess data = new DataAccess();
            DataSet ds;
            if (textBox1.Text != "")
            {
                conn += "and Studentinfo.sid='" + textBox1.Text + "'";
            }
            if (textBox3.Text != "")
            {
                conn += "and  Sname='" + textBox3.Text + "'";
            }
            if (textBox2.Text != "")
            {
                conn += "and Cid='" + textBox2.Text + "'";
            }
            if (textBox4.Text != "")
            {
                conn += "and Class='" + textBox4.Text + "'";
            }
            strsql = "select Courseinfo.Cid as 课程号,  Courseinfo.Cname as 课程名称 ,Studentinfo.Sname as 姓名,Studentinfo.Class as 班级,Studentinfo.Sid as 学号,Scoreinfo.Score as 成绩 from Studentinfo,Courseinfo,Scoreinfo where Courseinfo.Cid=Scoreinfo.Cid and Scoreinfo.Sid=Studentinfo.Sid" + conn;
            data.dataCon();
            ds = data.getDataset(strsql );
            dataGridView1.DataSource = ds.Tables[0];
        }
    }
}
